package org.vaadin.vaadinjit;

import org.vaadin.vaadinjit.widgetset.client.ui.VJitBarChart;

/**
 * Bar chart visualization
 * 
 * @author jonkka
 * @author deranen
 *
 */
@com.vaadin.ui.ClientWidget(VJitBarChart.class)
public class JitBarChart extends JitChartComponent {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public enum Orientation {
		HORIZONTAL, VERTICAL
	}
	
	/**
	 * The bar-orientation of the BarChart.
	 * Vertical orientation is default.
	 */
	private Orientation orientation = Orientation.VERTICAL;
	
	/**
	 * Creates a new JitBarChart
	 * 
	 */
	public JitBarChart() {
		super();
	}
	
	/**
	 * Create a new BarChart with the specified orientation
	 * 
	 * @param o
	 */
	public JitBarChart(Orientation o) {
		this();
		setOrientation(o);
	}
	
	/**
	 * Set the orientation of the BarChart.
	 * @param o The new orientation of the BarChart.
	 */
	public void setOrientation(Orientation o) {
		orientation = o;
		String orient = orientation == Orientation.HORIZONTAL ? "horizontal" : "vertical";
		this.setOption("orientation", orient);
	}

	
}
